// 和主进程相关的代码
import { app, BrowserWindow, session } from "electron";

process.env.ELECTRON_DISABLE_SECURITY_WARNINGS = true;

let mainWindow = null; // 存储窗口实例

app.whenReady().then(() => {
  mainWindow = new BrowserWindow({
    width: 400,
    height: 650,
    // transparent: true,
    // frame: false,
    // resizable: false,
    webPreferences: {
      nodeIntegration: true,
      contextIsolation: false,
    },
  });
  session.defaultSession.webRequest.onBeforeSendHeaders((details, callback) => {
    details.requestHeaders["AutoFill"] = "on";
    callback({ cancel: false, requestHeaders: details.requestHeaders });
  });
  mainWindow.loadURL(process.argv[2]);
});
